package edu.cebanc.spring.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import edu.cebanc.spring.bean.Mascota;

@Controller
@RequestMapping(value="/mascotas")
public class MascotasSpringController {
	
	private Map<String, Mascota> mascotas = new HashMap<String, Mascota>();
	
	@RequestMapping(method=RequestMethod.GET)
	public String getMainView(Model model) {
		model.addAttribute("mascotas", this.mascotas);
		
		return "mascotas/main";
	}
	
	@RequestMapping(method=RequestMethod.POST)
	public String managePet(Mascota mascota, BindingResult result) {
		return "";
		
	}
	
	@RequestMapping(value="createForm", method=RequestMethod.GET)
	public String getFormView(Model model) {
		Mascota mascota = new Mascota();
		model.addAttribute("nuevamascota", mascota);
		
		return "mascotas/form";
	}

	
}
